package com.thrd.taiexhibition.activity;

import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.thrd.basicframework.ui.webview.JSTest;
import com.thrd.basicframework.ui.webview.PanoramicWebView;
import com.thrd.taiexhibition.R;
import com.thrd.taiexhibition.base.BackTitleActivity;

/**
 * @author: ${唐杰}
 * @date: 2021/3/30
 */
@Route(path = "/app/panoramic",group = "app")
public class PanoramicActivity extends BackTitleActivity {

    private PanoramicWebView mWebView;

    @Override
    protected int getLayout() {
        return R.layout.activity_panoramic;
    }

    @Override
    protected void initView() {
        mWebView = (PanoramicWebView) findViewById(R.id.jwb_webview);
    }

    @Override
    protected void initData() {
//        mWebView.loadUrl("http://192.168.179.41:5500/index.html");// webView.loadUrl("file:///android_asset/index2.html");
        mWebView.loadUrl("file:///android_asset/pannellum/index.html");
        mWebView.addJavascriptInterface(new JSTest(PanoramicActivity.this),"JsTest");
    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        setContentView(new View(this));
        if(mWebView!=null){
            mWebView.stopLoading();
            mWebView.getSettings().setJavaScriptEnabled(false);
            mWebView.clearHistory();
            mWebView.clearView();
            mWebView.removeAllViews();
            mWebView.destroy();
            mWebView=null;
            System.gc();
        }
    }
}
